import { DispatchCtrlLib } from './DispatchCtrlLib'
function DispatchCallback() {}
// DispatchCallback.InitializeRsp=function(result){
//   if(result == 0){
//       login();
//     } else {
//       console.log("init fail");
//     }
// }
DispatchCallback.WebInitializersp=function(result){
  if(result == 0){
    login();
  } else {
    console.log("init fail");
  }
}

DispatchCallback.Initializersp=function(result){
  if(result == 0){
    queryFleetId();
    console.log("init success home_vue");
  } else {
    console.log("init fail");
  }
}

DispatchCallback.UninitializeRsp=function(result){
    if(Parm.Result==0){

    }else{

    }
}

DispatchCallback.WebUninitializeRsp=function(result){
  if(Parm.Result==0){

  }else{

  }
}

// DispatchCallback.WebLoginRsp=function(result,parm){
//   /*处理登录回调*/
//   loginrspdeal(result,parm);
// }

DispatchCallback.LoginRsp=function(result,parm){
  /*处理登录回调*/
  loginrspdeal(result,parm);
}

DispatchCallback.LogoutRsp=function(result){
    if(result==0){
      /*处理登录回调*/
      LogoutRspdeal(result);
        console.log('注销成功')
    }else{
        console.log('注销失败')
    }
}
// DispatchCallback.WebLogoutRsp=function(result){
//   if(result==0){
//     /*处理登录回调*/
//     LogoutRspdeal(result);
//     console.log('注销成功')
//   }else{
//     console.log('注销失败')
//   }
// }

DispatchCallback.ServerLinkStatusNotify=function(Parm){
    switch(Parm.Type){
        case 1:
            console.log('本地服务连接成功');
            break;
        case 2:
            console.log('本地服务断链');
            break;
        case 3:
            console.log('视频服务器连接成功');

            break;
        case 4:
            console.log('视频服务器断链');

            break;
        case 5:
            console.log('软交换服务器连接成功');
            break;
        case 6:
            console.log('软交换服务器断链');
            break;
        case 7:
            console.log('对讲服务器连接成功');

            break;
        case 8:
            console.log('对讲服务器断链');
            break;
        case 9:
            console.log('被踢下线');
            KickedOffline();
            break;
    }
}

DispatchCallback.MonitorVideoStatusNotify=function(parm){

}

DispatchCallback.MonitorVideoIncomingCallNotify=function(parm){

}

DispatchCallback.VoipCallStatusNotify=function(Type,Parm){
  Dispatchvoicersp(Type,Parm);
}

DispatchCallback.VoipIncomingCallNotify=function(parm){
  let type ='VoipIncomingCallNotify';
  Dispatchvoicersp(type,parm);

}

DispatchCallback.ConferenceStatusNotify=function(type,parm){
  DispatchConference(type, parm);
}



DispatchCallback.LocStartSubscribeRsp=function(parm){
    if(parm.Result==0){

    }else{
        console.log('订阅位置失败')
    }
}

DispatchCallback.LocUpdateNotify=function(parm){

}

DispatchCallback.VideoFileRsp=function(parm){
    if(parm.Result==0){

    }else{
        console.log('请求录像地址失败')
    }
}

DispatchCallback.StatusNotify=function(obj){
    // var status=obj.Status;
    // if(status==0){
    //     console.log('终端离线')
    // }else if(status==1){
    //     console.log('终端在线')
    // }else if(status==3){
    //     console.log('终端在线且上报位置中')
    // }
  let Msg = "delPttTalkStatusList";
  Dispatchpoc(Msg,obj);

}
//消息发送成功回调
DispatchCallback.MsgSendRsp=function(parm){
  var Msg = "MsgSendRspDeal";
  DispatchMessage(Msg,parm);
}

DispatchCallback.MsgRecvNotify=function(obj,TargetType,MsgType){
  var Msg = "MsgRecvNotify";
  DispatchMessage(Msg,obj);                     //发送成功后界面变化
}

DispatchCallback.ServerBroadcastNotify=function(Parm){
    if(Parm.OperType==1){
        // console.log('呼叫调度台')

    }else if(Parm.OperType==2){
        // console.log('一键告警')

    }else if(Parm.OperType==3){
        // console.log('多媒体上传通知')

    }else if(Parm.OperType==6){
        // console.log('事件上报')

    }else if(Parm.OperType==31){
      BroadcastNotify(Parm);
      console.log('收到广播通知');
    }
    else if(Parm.OperType==98){
      ReceiveSosNotify(Parm);
      console.log('收到告警通知');
    }
}

DispatchCallback.LocalDevShowRsp=function(Parm){

}
//开始/取消监听应答
DispatchCallback.PttMonitorRsp=function(Parm){
  let Msg = "dealPttMonitorRsp";
  Dispatchpoc(Msg,Parm);
}
//发起/结束呼叫应答
DispatchCallback.PttCallRsp=function(Parm){
  let Msg = "dealPttCallRsp";
  Dispatchpoc(Msg,Parm);
}
////申请话权响应的事件
DispatchCallback.PttTalkRequestRsp=function(Parm){
  let Msg = "delPttTalkRequestRsp";
  Dispatchpoc(Msg,Parm);
}
//释放话权响应的事件
DispatchCallback.PttTalkReleaseRsp=function(Parm){
  let Msg = "delPttTalkReleaseRsp";
  Dispatchpoc(Msg,Parm);
}
//呼叫监听状态应答
DispatchCallback.PttCallStatusNotify=function(Parm){
  let Msg = "delPttCallStatusNotify";
  Dispatchpoc(Msg,Parm);
}
//话权状态通知
DispatchCallback.PttTalkStatusNotify=function(Parm){
  console.log("PttTalkStatusNotify-----------------")
  let Msg = "delPttTalkStatusNotify";
  Dispatchpoc(Msg,Parm);
}

DispatchCallback.FenceNotify=function(Parm){

}

DispatchCallback.FenceHandleNotify=function(Parm){

}

DispatchCallback.PttDesktopPttNotify=function(Parm){

}

DispatchCallback.WinMsgNotify=function(Parm){
    if(Parm.Target == "Main"&&Parm.Source == "Conference"){
        var content = Parm.Content;
        console.log(content);
      RefreshHomePage(content);
    }
  HandleCombinedVersionPages(Parm);
}

DispatchCallback.VoipDispatchMoniterStatusNotify=function(Type,Parm){
  Dispatchvoicersp(Type,Parm);
}

DispatchCallback.VoipDispatchCallRsp=function(Parm){
  AgentVoipDispatchCallRsp(Parm)
/*    switch(Parm.Type) {
        case 1:  //强插
          AgentVoipDispatchCallRsp(Msg,Parm)
            break;
        case 2:  //强拆
          let Msg = "dealhandleSubstituteForcing";//强拆
          AgentVoipDispatchCallRsp(Msg,Parm)
            break;
        case 3:  //监听

            break;
        case 4:  //呼叫转会议

            break;
        case 5:  //代接

            break;
    }
    if (Parm.Result != 0){}*/

}

DispatchCallback.VoipHoldCallRsp=function(Type,Parm){
  Dispatchvoice(Type,Parm);
}

DispatchCallback.VoipTransferCallRsp=function(Type,Parm){
  Dispatchvoice(Type,Parm);
}

DispatchCallback.VoipDispatchFifoNotify=function(Type,Parm){
  Dispatchvoicersp(Type,Parm);
}
DispatchCallback.ConferenceInviteNotify=function(Type,Parm){
  DispatchConferencersp(Type, Parm);
}
DispatchCallback.ConferenceEnterNotify=function(Type,Parm){
  DispatchConferencersp(Type, Parm);
}
export { DispatchCallback }
